﻿@model yq.WebModel.Sys.AddUser
@Url.Css("Css/metro/css/list.css")
@Url.Script("Scripts/metro/info.js")
@Url.TreeScript()
<script>
    function OnSuccessForm(obj) {

        if (obj.Status == 1) {
            $.confim("您需要继续添加吗？", function () {
                window.location = window.location;
            }, function () {
                window.location = '@(Url.Action("Index"))';
            }); 
        } else {
            $.tips(obj.ErrorText);
        }
    }
</script>
<div id="container" class="container">
    @Html.Action("Navigation", "Home")
    @Html.Action("RowLeft", "PublicReuse", new { Area = "Home", back = true })
    <div id="container_r" class="container_right">
        @Html.Action("HeadTitle", "PublicReuse", new { Area = "Home" })
        <div class="icodiv">
        </div>
        <div class="span8" style="padding-top: 0px">
            @using (Ajax.BeginForm("DoAddUser", new { }, new AjaxOptions { OnSuccess = "OnSuccessForm" }, new { @class = "form-horizontal", novalidate = "novalidate" }))
            { 
                <fieldset>
                    <div class="alert alert-info" style="margin-top: 0px; margin-bottom: 20px; text-align: left">
                        账号信息
                    </div>
                    <div class="control-group">
                        <div>
                            <label class="control-label">@Html.RawFor(obj => obj.Account.NickName)</label>
                            <div class="controls">
                                @Html.TextBoxFor(obj => obj.Account.NickName)
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="disabledInput">
                            @Html.RawFor(obj => obj.Account.PurviewEnum)</label>
                        <div class="controls">
                            @Html.SelectEnumFor(obj => obj.Account.PurviewEnum, yq.Enums.UserAccount.PurviewEnum.Default)
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="optionsCheckbox2">
                            @Html.RawFor(obj => obj.Account.State)</label>
                        <div class="controls">
                            @Html.SelectEnumFor(obj => obj.Account.State, yq.Enums.UserAccount.State.Default)
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="optionsCheckbox2">
                            @Html.RawFor(obj => obj.Login.Account)</label>
                        <div class="controls">
                            @Html.TextBoxFor(obj => obj.Login.Account)
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="optionsCheckbox2">
                            @Html.RawFor(obj => obj.Login.PassWord)</label>
                        <div class="controls">
                            @Html.PasswordFor(obj => obj.Login.PassWord, new { onchange = "onRePassWord()" })
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="optionsCheckbox2">
                            确认密码</label>
                        <div class="controls">
                            @Html.Password("RePassWord", null, new { onchange = "onRePassWord()" })
                        </div>
                    </div>

                     <div class="control-group">
                        <label class="control-label" for="optionsCheckbox2">
                            @Html.RawFor(obj => obj.Info.DepartmentId)</label>
                        <div class="controls">
                            @Html.DoubleDialog(obj => obj.Info.DepartmentId, Url.Action("SelectDepartment", "Department"), "")
                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label">
                        </label>
                        <div class="controls">
                            @Html.Submit(" 保 存 ")
                        </div>
                    </div>
                </fieldset>  
            }
        </div>
    </div>
</div>
<script>
    function onRePassWord()
    {
        if ($("#RePassWord").val() + "a" == "a" || $("#RePassWord").val() != $("#Login_PassWord").val())
        {
            $.inputError("RePassWord", "请确认密码");
            return false;
        } else
        {
            $.inputYes("RePassWord");
            return true;
        }
    }
</script>
